package com.joinway.admin.compact;

import java.util.Date;

import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;

import com.joinway.framework.admin.bean.UserContext;
import com.joinway.framework.admin.bean.domain.AdminUser;
import com.joinway.framework.admin.core.constant.AdminWebConstants;
import com.joinway.framework.admin.core.service.AdminWebService;
import com.joinway.framework.core.utils.FrameworkHelper;

@Service
public class CompactAdminWebService extends AdminWebService {

	@Override
	public int getPriority() {
		return 10;
	}

	@Override
	public ModelAndView index() {
		UserContext uc = new UserContext();
		
		AdminUser user = new AdminUser();
		user.setLastLoginTime(new Date());
		user.setLoginCount(1);
		user.setLoginName("test");
		user.setName("test");
		user.setId(1);
		
		uc.setUser(user);
		
		FrameworkHelper.getHttpServletRequest().getSession().setAttribute(AdminWebConstants.USER_CONTEXT_KEY, uc);

		return new ModelAndView("main");
	}

	
}
